System and method of caching information

ABSTRACT

A system and method is provided wherein, in one aspect, a currently-requested item of information is stored in a cache based on whether it has been previously requested and, if so, the time of the previous request. If the item has not been previously requested, it may not be stored in the cache. If the subject item has been previously requested, it may or may not be cached based on a comparison of durations, namely (1) the duration of time between the current request and the previous request for the subject item and (2) for each other item in the cache, the duration of time between the current request and the previous request for the other item. If the duration associated with the subject item is less than the duration of another item in the cache, the subject item may be stored in the cache.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is a divisional of U.S. patent application Ser.No. 13/213,779, filed Aug. 19, 2011, which is a continuation of U.S.patent application Ser. No. 12/545,225, filed Aug. 21, 2009, thedisclosures of which are all incorporated herein by reference.

BACKGROUND

A cache is commonly provided in a system having a processor to storeitems of information for access by the processor at a lower “cost” thanif the cache were not present. For example, a system may be structuredsuch that the processor can obtain data or program instructions storedin one memory faster than other memories. This memory may be used as acache so that frequently-accessed information contained in the othermemories may be copied into and accessed from the cache instead. Inaddition, the use of a cache may help to reduce internal data trafficbetween the processor and internal system elements such as a memory orinput-output interface when the information items are available locally,as well as reduce external data traffic between the system and a remotesystem when the information is not available locally.

Caches are often too small to store all of the information a processormay need. Accordingly, cache-based systems typically need to beselective when it comes to determining which information will be storedin the cache. For example, a processor may repeatedly and frequentlyaccess ten different items of information, but the cache may only beable to store five.

Various algorithms have been used to determine when an item should bestored in the cache. For example, some existing systems automaticallystore the most-recently used information in the cache. If the processorrecently processed ten items and the cache can store five, the last fivediscrete items are stored in the cache regardless of how often the itemsare used.

SUMMARY

This disclosure provides for a system that includes a first memoryhaving a first capacity, a second memory having a second capacity, thesecond capacity being greater than the first capacity, and one or moreprocessors coupled to the first and second memories. The one or moreprocessors may be configured to receive a request for a given item ofinformation stored in the second memory and determine a priority valuefor the given item and each item from a plurality of items ofinformation, the priority value defined as:E_(n)=−1*(ALPHA*LS_(n)+(1−ALPHA)*E_(n-1)), where, “n” represents then^(th) occurrence of a request for the given item, “E_(n)” representsthe priority value at the n^(th) occurrence of the request for the givenitem, “LS_(n)” represents the amount of time that elapsed between then^(th) occurrence of the request for the given item and the previousrequest for the given item, and “ALPHA” represents a value between andincluding 0 and 1. The one or more processors may be further configuredto store the given item in the first memory when (i) the given item hasbeen previously requested, and (ii) the priority value of the given itemis greater than the priority value of at least one other item selectedfrom the plurality of items.

In another embodiment of the disclosed system, the priority value isassigned a default value when the given item of information has not beenpreviously requested.

In a further embodiment of the disclosed system, the default valueindicates that the given item of information has a predeterminedpriority.

In yet another embodiment of the disclosed system, the priority valueindicates whether the request for the given item is a first request.

In yet a further embodiment of the disclosed system, wherein the valueof ALPHA is assigned the value of “1” when the one or more processorsdetermine that the request for the given item is a second request.

In another embodiment of the disclosed system, the first memory has afirst access time, the second memory has a second access time, and thefirst access time is less than the second access time.

In a further embodiment of the disclosed system, the first access timeis an average time for the one or more processors to obtain informationfrom the first memory.

In yet another embodiment of the disclosed system, the at least oneother item is removed prior to storing the given item in the firstmemory.

In yet a further embodiment of the disclosed system, the at least oneother item is removed when the size of the given item exceeds the sizeof the first memory minus the combined size of plurality of items storedin the first memory.

In another embodiment of the disclosed system, the priority function isbased on a duration of time between requests for items with less weightand is applied to durations between earlier requests for the given item.

This disclosure also provides for a method that includes receiving, withone or more processors, a request for a given item of information storedin a first memory, the first memory having a first capacity,determining, with the one or more processors, a priority value for thegiven item and each item from a plurality of items of information, thepriority value defined as: E_(n)=−1*(ALPHA*LS_(n)+(1−ALPHA) E_(n-1)),where, “n” represents the n^(th) occurrence of a request for the givenitem, “E_(n)” represents the priority value at the n^(th) occurrence ofthe request for the given item, “LS_(n)” represents the amount of timethat elapsed between the n^(th) occurrence of the request for the givenitem and the previous request for the given item, “ALPHA” represents avalue between and including 0 and 1, and storing, with the one or moreprocessors, the given item in a second memory when (i) the given itemhas been previously requested, and (ii) the priority value of the givenitem is greater than the priority value of at least one other itemselected from the plurality of items, wherein the second memory has acapacity less than a capacity of the first memory.

In another embodiment of the disclosed method, the method furtherincludes assigning the priority value a default value when the givenitem of information has not been previously requested.

In a further embodiment of the disclosed method, the default valueindicates that the given item of information has a predeterminedpriority.

In yet another embodiment of the disclosed method, the method includesassigning the priority value a predetermined value that indicateswhether the request for the given item is a first request.

In yet a further embodiment of the disclosed method, the value of ALPHAis assigned the value of “1” when the one or more processors determinethat the request for the given item is a second request.

In another embodiment of the disclosed method, the first memory has afirst access time, the second memory has a second access time, and thesecond access time is less than the first access time.

In a further embodiment of the disclosed method, the first access timeis an average time for the one or more processors to obtain informationfrom the first memory.

In yet another embodiment of the disclosed method, the at least oneother item is removed prior to storing the given item in the secondmemory.

In yet a further embodiment of the disclosed method, the at least oneother item is removed when the size of the given item exceeds the sizeof the second memory minus the combined size of plurality of itemsstored in the second memory.

In another embodiment of the disclosed method, the priority function isbased on a duration of time between requests for items with less weightand is applied to durations between earlier requests for the given item.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a functional diagram of a system of servers and client devicesin accordance with aspects of the disclosure.

FIG. 2 is a functional diagram of a computer chip and instruction storein accordance with aspects of the disclosure.

FIG. 3 is a functional diagram of a multi-tiered system of servers andclient devices in accordance with aspects of the disclosure.

FIG. 4 is a functional diagram of computer in accordance with aspects ofthe disclosure.

FIG. 5 is a flowchart in accordance with aspects of the disclosure.

FIG. 6 is a flowchart in accordance with aspects of the disclosure.

DETAILED DESCRIPTION

In accordance with one aspect of this disclosure, a currently-requesteditem of information is stored in the cache based on whether it has beenpreviously requested and, if so, the time of the previous request.Specifically, if the item has never been previously requested, the itemis not stored in the cache (where “never” may refer to a predeterminedperiod of time, such as “never within the 24 hours” or never within aperiod of time that is dynamically determined based on data that changesover time). If the subject item has been previously requested, thesubject item is cached based on a determination and comparison ofdurations, namely (1) the duration of time between the current requestand the previous request for the subject item and (2) for each otheritem in the cache, the duration of time between the current request andthe previous request for the other item. If the duration associated withthe subject item is less than the duration of another item in the cache,the subject item will be stored in the cache.

As shown in FIG. 1, a system 100 in accordance with one aspect of thisdisclosure includes a computer 110 containing a processor 120, memory130, clock 115 and other components typically present in general purposecomputers. Memory 130 stores information accessible by processor 120,including instructions 131 that may be executed by the processor 120. Italso includes data 135 that may be retrieved, manipulated or stored bythe processor. The memory may be of any type capable of storinginformation accessible by the processor, including a computer-readablemedium such as a hard-drive, memory card, ROM, RAM, DVD or other opticaldisks, as well as other write-capable and read-only memories. Theprocessor 120 may be any well-known processor, such as processors fromIntel Corporation or AMD. Alternatively, the processor may be adedicated controller such as an ASIC.

The instructions 131 may be any set of instructions to be executeddirectly (such as machine code) or indirectly (such as scripts) by theprocessor. For example, the instructions may be stored as computer codeon the computer-readable medium. In that regard, the terms“instructions” and “programs” may be used interchangeably herein. Theinstructions may be stored in object code format for direct processingby the processor, or in any other computer language including scripts orcollections of independent source code modules that are interpreted ondemand or compiled in advance. Functions, methods and routines of theinstructions are explained in more detail below.

Data 135 may be retrieved, stored or modified by processor 120 inaccordance with the instructions 131. For instance, although the systemand method is not limited by any particular data structure, the data maybe stored in computer registers, in a relational database as a tablehaving a plurality of different fields and records, XML documents orflat files. The data may also be formatted in any computer-readableformat such as, but not limited to, binary values, ASCII or Unicode.Image data may be stored as bitmaps comprised of pixels that are storedin accordance with formats that are compressed or uncompressed, lossless(e.g., BMP) or lossy (e.g., JPEG), and bitmap or vector-based (e.g.,SVG), as well as computer instructions for drawing graphics. Video datamay be stored in a variety of formats including MPEG, GIF, AVI, M-JPEG,Flash, QuickTime and others. The data may comprise any informationsufficient to identify the relevant information, such as numbers,descriptive text, proprietary codes, pointers, references to data storedin other memories (including other network locations) or informationthat is used by a function to calculate the relevant data.

Although FIG. 1 functionally illustrates the processor and memory asbeing within the same block, it will be understood by those of ordinaryskill in the art that the processor and memory may actually comprisemultiple processors and memories that may or may not be stored withinthe same physical housing. For example, some of the instructions anddata may be stored on removable CD-ROM and others within a read-onlycomputer chip. Some or all of the instructions and data may be stored ina location physically remote from, yet still accessible by, theprocessor. Accordingly, references to a computer, processor and memorywill be understood to include references to a collection of computers,processors or computers that may or may not operate in parallel.

Computer 110 may be located at one or more nodes of a network 195 andcapable of directly and indirectly communicating with other nodes of thenetwork. For example, computer 110 may comprise a web server that iscapable of communicating with client devices 150-52 via network 195,delivering web pages to the client devices 150-52 and receivinginformation and requests in response. Server 110 may use network 195 totransmit and display information to a user on monitor 160 of clientdevice 150.

Network 195, and intervening nodes between server 110 and clientdevices, may comprise various configurations and use various protocolsincluding the Internet, World Wide Web, intranets, virtual privatenetworks, wide area networks, local networks, private networks usingcommunication protocols proprietary to one or more companies, cellularand other wireless networks, Internet relay chat channels (IRC), instantmessaging, simple mail transfer protocols (SMTP), Ethernet, WiFi andHTTP, and various combinations of the foregoing. Although only a fewcomputers are depicted in FIG. 1, it will be appreciated that a typicalsystem can include a large number of connected computers.

Each client device may be configured similarly to the server 110, with aprocessor, memory and instructions. Each client device 150-52 may be apersonal computer, intended for use by a person 190-191, having all theinternal components normally found in a personal computer such as acentral processing unit (CPU), display device 160 (for example, amonitor having a screen, a projector, a touch-screen, a small LCDscreen, a television, or another device such as an electrical devicethat is operable to display information processed by a processor), DVDdrive, hard-drive, user input device 163 (for example, a mouse,keyboard, touch-screen or microphone), speakers, modem or networkinterface device (telephone, cable, wireless or otherwise), and all ofthe components used for connecting these elements to one another.

Although the client devices 150-52 may comprise a full-sized personalcomputer, the system and method may also be used in connection withmobile devices capable of wirelessly exchanging data with a server overa network such as the Internet. For example, a client device may be awireless-enabled PDA such as a Blackberry phone or an Internet-capablecellular phone. The user may input information using a small keyboard(in the case of a Blackberry phone), a keypad (in the case of a typicalcell phone), a touch screen (in the case of a PDA) or any other userinput device. Indeed, computers in accordance with the systems andmethods described herein may comprise any device capable of processinginstructions and transmitting data to and from humans and othercomputers including general purpose computers, network computers lackinglocal storage capability, and set-top boxes for televisions.

In addition to server 110, system 100 may include other servers as well.For example, servers 115-16 may store information to be delivered toother nodes of the network such as audio/visual video files offered viaGoogle's YouTube service. Other non-limiting examples of contentincludes music, still images, programs including computer games andcombinations of the foregoing. The visual content may be rendered to auser via the electronic display 160 of the client device and the audiocontent may be rendered via speakers associated with the client device.The content may be provided for free or fee-based, and may be restrictedor subject to digital rights management (DRM).

Server 110 may communicate with content servers 115-16 via a network196. The network may be configured similarly to network 195. Indeed, inat least one aspect, networks 195 and 196 share the same nodes; forexample, both networks 195 and 196 may comprises the Internet.

Server 110 may include a cache 140 that stores information that may berequired by the server for future use. For example, the cache may storecontent files originally received from servers 115-16 and provided tothe client devices 150-52. As explained in more detail below, this isjust one possible aspect of a system and method in accordance withaspects of this disclosure.

In one aspect and in many circumstances, the server 110 is typicallyable to deliver information from cache 140 to client devices 150-52faster than obtaining the information from content servers 115-16. Forexample, server 110 may be geographically closer to the client devicesthan the content servers. Server 100 may also be topologically closer tothe client devices, e.g., if the Internet is serving as both network 195and network 196, there may be more intervening nodes between contentserver 115 and client device 150 than between server 110 and clientdevice 150. Yet further, the cache 140 may be stored in the same housingas processor 120, such as a large hard drive physically located within aserver; such configurations typically provide the processor with veryfast access to the information. However, the cache 140 may also be inanother location that results in more latency than a hard drive but lesslatency than obtaining the information from content servers 115-16.

The system and method may store, retrieve and process information invarious formats, configurations and sizes. In that regard, the items ofinformation stored in the cache can be of different sizes or can havethe same size. In some aspects, each item is a single file thatrepresents all of the information desired by a user (e.g., the file is amusic video of an entire song). In other aspects, each item is afixed-size packet of information that cannot be meaningfully used by auser until the user's client device receives and assembles multiplepackets together. Combinations of the foregoing are also possible, e.g.,each individual item in the cache may be fixed-sized portion of a musicvideo, and the server 110 streams a music video to the user's clientdevice by retrieving and transmitting individual packets from the cache.

The system and method may also process data indicative of the length oftime between requests for items. For example, data 135 may store requestrecords 145 where each record identifies a content file 143 stored incache 140 and the date and time that the file was last requested by aclient device. In one aspect, the request records 145 may be stored as ahash table where the key is the file's identifier (e.g., a unique numberassigned to each different video file) and the key points to the dateand time that a client device last requested the file.

The request records may also identify whether the item is stored in thecache, because not all requested items may be cached andpreviously-requested items may be cached and then evicted from thecache.

Some aspects may store additional information as well, as noted below.

In addition to the operations illustrated in FIG. 5, various operationsin accordance with a variety of aspects of the disclosure will now bedescribed. It should be understood that the following operations do nothave to be performed in the precise order described below. Rather,various steps can be handled in reverse order or simultaneously.

In one aspect, the system and method includes a server that uses thecache to store information that may be requested by the client devices.For example, server 110 may be one of many servers edge serverassociated with a website such as www.youtube.com. In that regard, auser may use client device 150 to interact with a web server thatoperates a video file search engine. The engine server may provide theuser with a list of matching videos, and allow the user to then selectand go to a webpage that is specific to the desired video. Although itwas served by the engine server, this video-specific webpage may containa URL that points directly at server 110 and the file's unique ID.Accordingly, when the user requests a copy of the video, such as byclicking a “play” button, the request is sent directly to server 110rather than the engine server.

Upon receiving the request for the information, the system and methodmay cause the requested information to be retrieved and provided to therequesting entity. For example, server 110 may first determine whethercache 140 contains a copy of a requested content file. If the file iscontained in the cache, the processor 120 may transmit a copy of thefile from the cache 145 to client device 150 via network 195. If thefile is not contained in the cache, the processor may request the filefrom one of the content servers 115-16 and forward it to the clientdevice 150, such as by proxying. Alternatively, the server 110 mayprovide the content server or the client device with sufficientinformation so that the client device can obtain the file from thecontent server without passing the file through server 110, such as byproviding a reference to the location via an HTTP 302 redirect.

When the processor receives a request for the information, it determineswhether the information has been previously requested. For example, theserver 110 may query request records 145 and determine whether thecontent file has been previously requested from any of the clientdevices 150-52. If the records are stored in a hash table, processor 120may check the hash table for a record having a key that matches thefile's UID. If such a key is missing, processor 120 determines that thefile has not been previously requested. If the key is present, processor120 determines that the file has been previously requested.

If the requested item has not been previously requested, the system andmethod does not cache the information but does store data related to thetime of the request. For example, it may add a key/value pair to thehash table 145 that identifies the UID of the requested file and thedate and time of the request. It may also include a value in the record,such as a flag, indicating that the file is not currently stored in thecache.

If the desired information has been previously requested, the processordetermines the last time it was previously requested and compares itwith information identifying the request times of other information inthe cache. The decision to cache or not may be based on thatdetermination.

In one aspect of the system and method, an item is cached if, excludingthe time of the current request, it was more recently requested thananother item in the cache. For example, assume that server 110 receivesa request for “File #3” at 7:00 pm and the request records 145 identifythe following information:

Date and time the item Item currently UID was last requested stored incache? 1 1:00 pm Yes 2 2:00 pm NO 3 3:00 pm NO 4 4:00 pm Yes 5 5:00 pmNO 6 6:00 pm Yes

Based on the foregoing, File #3 was requested more recently (3:00 pm)than File #1 (1:00 pm)—excluding the time of the current request.Accordingly, File #3 would be stored to the cache.

If the cache lacks the capacity to store the currently-requested item,the system and method may remove the item that has sat in the cache thelongest since its last request. Using the foregoing example, it has beensix hours (7:00 pm minus 1:00 pm) since File #1 was previouslyrequested. Therefore, no matter when the next request comes in for File#1, the duration between the last request and the next request cannot beany less than six hours. This duration is longer than any anotherduration for any other file. Accordingly, if there is not enough roomfor both File #1 and File #3, File #1 may be removed from the cache 140,File #3 may be added to the cache, and the request records 145 mayupdated as follows (changes from the last chart are shown in bold).

Date and time when the Item currently UID item was last requested storedin cache? 1 1:00 pm NO 2 2:00 pm NO 3 7:00 pm Yes 4 4:00 pm Yes 5 5:00pm NO 6 6:00 pm Yes

If there is still insufficient room to store the currently-requesteditem after another item is removed, the system and method may continueto evict items until enough room is provided.

In one aspect, the system and method uses the data associated with themost-recently evicted item to determine whether the currently-requesteditem should be cached. For example, when File #1 is removed, server 110may store a pointer in data 135 to the request record for File #1, asindicated by the “-X->” below.

Date and time when the Item currently UID item was last requested storedin cache? −X−> 1 1:00 pm NO 2 2:00 pm NO 3 7:00 pm Yes 4 4:00 pm Yes 55:00 pm NO 6 6:00 pm Yes

Assume that server 110 next receives a request for File #5 at 8:00 pm.Rather than comparing the last time that the currently-requested itemwas requested with every item in the cache, the processor may compare itwith the most recently removed item. In that regard, having determinedthat File #5 was previously requested (5:00 pm) more recently than thefile that was just evicted (File #1 at 1:00 pm), File #5 may be added tothe cache. If File #4 had to be removed to make room for File #5, theresulting request records 145 may appear as follows.

Date and time when the Item currently UID item was last requested storedin cache? 1 1:00 pm NO 2 2:00 pm NO 3 7:00 pm Yes −X−> 4 4:00 pm NO 58:00 pm Yes 6 6:00 pm Yes

In another aspect, the system and method may compare the current itemagainst the amount of time that the last-evicted item survived in thecache since its last request. Returning to the foregoing example, whenthe system and method had to pick an item to evict at 7:00 pm, itevicted File #1 because no other item had sat in the cache longerwithout a request. Thus, if one defines the “worst performer” as themost-recently evicted item, and if one defines its “wasted time” as thelength of time it sat in the cache unrequested prior to its conviction,File #1 was the worst performer and it wasted six hours (7:00 evictionminus 1:00 last request).

In that regard, if the new item is expected to “waste” more time thanthe “worst performer,” one aspect of the system and method may determinethat the new item should not cached at all. In that regard and thisaspect, File #5 will be cached when it is requested because the spanbetween its last request (5:00 pm) and its current request (8:00 pm) isthree hours, which is less time than that wasted by the worst performer(six hours). However, assume that File #11 is requested at the same timeas File #5 (8:00 pm), but File #11 was previously requested nine hoursago (at 11:00 am). If File #11 was placed in the cache and it wentanother nine hours without a request, this would mean it wasted moretime in the cache than the current worst performer: File #1 at sixhours. Accordingly, the system and method may determine that File #11should not be cached at all.

If the last time the currently-requested item was requested is earlierthan other items in the cache, the processor may decide not to cache theitem. Even so, it may still update the request records to reflect thetime of the current request. For example, assume that the requestrecords appear as follows when a request for File #1 is received at 9:00pm.

Date and time when the Item currently UID item was last requested storedin cache? 1 1:00 pm NO 2 2:00 pm NO 3 7:00 pm Yes −X−> 4 4:00 pm NO 58:00 pm Yes 6 6:00 pm Yes

The system and method may compare the prior request for thecurrently-requested item (File #1 at 1:00 pm) with the latest requestfor the most recently evicted item (File #4 at 4:00). Even though File#4 was just evicted for remaining in the cache too long without arequest, it was more recently requested than File #1 (putting aside thefact that the system is evaluating the current request for File #1).Thus, File #1 will not be placed in the cache, but its records will beupdated as follows.

Date and time when the Item currently UID item was last requested storedin cache? 1 9:00 pm NO 2 2:00 pm NO 3 7:00 pm Yes −X−> 4 4:00 pm NO 58:00 pm Yes 6 6:00 pm Yes

In that regard, if File #1 is requested again an hour later at 10:00 pm,it will be added to the cache because it was requested more recently(9:00 pm) than the item that was just evicted (File #4 at 4:00 pm).

As noted above, one aspect of the system and method uses the time of thecurrent request and the time of the last request (among other things) todetermine whether an item should be cached.

In another aspect, the system and method uses the time of the currentrequest, the time of the last request and the time of earlier requestsas well to make the determination. Moreover, the system and method mayapply different weights when making the determination. For instance,when determining whether an item should be cached, that time of thelatest requests may be considered more important than the time of theearlier requests.

One such system and method uses exponential decay. By way of exampleonly, each item may be assigned a priority value such that a lowerpriority item will be removed from the cache, if necessary, to make roomfor a higher priority item. Just one possible method comprises assigningeach item a priority value of “E” where:

E _(n)=−1*(ALPHA*LS _(n)+(1−ALPHA)*E _(n-1));

“n” represents the n^(th) occurrence of the request, e.g., E₁₀represents the priority value of the item after it was requested 10times;

“LS_(n)” represents the amount of time that elapsed between the n^(th)occurrence of the request and the previous request, e.g., LS₁₀represents the amount of time that elapsed between the ninth and tenthrequest for the item; and

“ALPHA” represents a value between and including 0 and 1.

In that regard, the processor may calculate a priority value for an itemeach time it is requested. If the value indicates that the item ishigher in priority than other items in the cache, the item is cached. Ifthere is not enough room for the item in the cache, lower priority itemsmay be removed. (It will be understood that the −1 multiplier in theforegoing formula may be omitted, in which case higher E_(n) values maybe considered less desirable for caching than lower E_(n) value.)

As noted above, the priority value may be calculated such that recentrequests are accorded more weight than older requests. In that regard,if the foregoing formula for E_(n) is used, ALPHA may be selected toprovide more or less weight to the most recent request. For example, ifALPHA is selected to be 0.9, 90% of the priority value will depend onthe duration of time between the current request and the last request.However, if ALPHA is selected to be 0.2, only 20% of the priority valuewill depend on the duration of time between the current request and thelast request; the remainder of the value will depend on durationsbetween prior requests. In that regard, ALPHA may be selected based onthe needs of the system. ALPHA may also be automatically and dynamicallyadjusted over time based on periodic statistical analyses of the system.

The impact of a prior request on an item's cache priority mayexponentially diminish as more subsequent requests are received. Forexample, assume there are 10 requests for the item. Even if the ALPHAvalue of E_(n) is set to 0.2 (making only 20% of the priority valuedependant on the duration between the two most recent requests), theduration of time between the 1st and 2nd requests will affect thepriority value far less than the duration of time between the 9th and10th requests. Indeed, if ALPHA is 0.2 and there are approximately 10requests, the impact of the latest duration relative to the earliestdurations may be approximately 10:1. On the other hand, ALPHA may be setto 1, in which case the priority value depends entirely on the durationbetween the latest requests.

If a request for an item is received for the first time and theforegoing formula for E_(n) is used, a default value for E_(zero) may beselected. Because lower E values typically indicate higher priorityitems, a low default value for E_(zero) may be selected if it ispreferable to give never-seen-before items a high priority, and viceversa.

Alternatively, the request records 145 may store a single value of “E”for each item, i.e., it does not store a separate E value for eachrequest of each item. In that regard, when an item is requested for thefirst time, a special value for E may be stored to indicate that theitem's last request was also its first request. When the next requestfor the item is received, the system and method may check whether thecurrent E value equals the special value. If so, the value of E may becalculated as if ALPHA=1, which places all of the weight in the formulato the span of time between the first and second request. If the systemand method determines that the value of current value of E is not thespecial value, the formula may be calculated in accordance with theusual value of ALPHA. Regardless, the system and method may then replacethe prior value of E with the newly-calculated value for E.

One of the advantages of the system and method is its flexibility, suchas its ability is to be implemented in configurations that are differentfrom the foregoing aspects or that can be synergistically combined withthe foregoing aspects.

For example, the foregoing system and method may be combined with othersystems and methods for determining whether an item of informationshould be cached. In that regard, there may be circumstances in whichthe item is cached in spite of the fact that it has never beenpreviously requested. The processor may automatically store an item inthe cache whenever there is room, i.e., the size of the item is lessthan the total capacity of the cache minus the combined sizes of the allof the other items (if any) stored in the cache. Alternatively, theremay be other characteristics associated with an item that may indicatewhether it should be cached. For example, the processor may be providedwith information indicating that the file is very popular and the E_(n)formula described above may include the popularity of the file as aweighted factor.

The system and method may also base a caching decision on the time ofthe request without storing the precise date and time of requests. Asnoted above in connection with priority values, the system and methodmay store a value that is calculated from a formula having manyparameters, only one of which is the request time.

As also noted above, the system and method is not limited to anyparticular size of item. By way of example only, individual items maycomprise variable-sized files, fixed-sized portions of data or both. Onemay consider the example of a variable-sized video file that is storedand streamed in fixed-size chunks, such as 8.5 MB file comprising fourchunks of 2 MB each and one chunk of 0.5 MB. It is common for users toterminate a video after watching the beginning, so it is quite possiblethat the server will only send the first chunk or two. In one aspect,the system and method may consider each chunk to be a separate item, inwhich case the first two chunks might be cached but the remainder mightnot.

In another aspect, the system and method may consider the entire file tobe a single item, in which case all of the chunks are cached in responseto repeated requests for the file even if only the first one or twochunks are consistently delivered to end users. This aspect may beparticularly useful when server 110 serves a file from another server byproxy in accordance with HTTP protocol; it may not be possible forserver 110 to stream the first two chunks of a requested file from itscache and the remainder through a redirect to another server.

In still another aspect, the system and method may cache an entire itemin accordance with the system and method yet evict portions of item inaccordance with different criteria. For example, the server may cacheall four chunks of the 8.5 MB file based on the request records for thefile. However, the server may also use a well-known caching algorithm(e.g., a Least Recently Used (LRU) algorithm) to occasionally evictunpopular chunks, such as the last two chunks of the 8.5 MB file if theyare rarely sent to users. As noted above, the system and method maydetermine whether to cache a newly-requested item by comparing therequest times of the newly-requested file with the most-recently evicteditem's span of survival. In the aspect described in this paragraph, thesystem and method may compare a newly-requested file's request timeswith the survival times of the most-recently evicted chunk.

Moreover, while particular advantages may flow when the system andmethod is used in connection with large client/server content-deliverynetworks, certain aspects may also be implemented in an enclosed systemas small as a computer chip. By way of example only and as shown in FIG.2, a microprocessor 210 may pre-fetch sequences of microcodeinstructions from an instruction source 220 and store them in arelatively small cache 230 on a single semiconductor chip 240 if thesystem expects that the instructions will be used in the near future. Inthat regard, an individual item of information may constitute a sequenceof microcode instructions that are retrieved and processed by themicroprocessor. When the microprocessor 210 needs and instruction, itmay request it from cache control 250. If the instruction is part of abranch of instructions and the instruction's branch is stored in cache230, control 250 provides the instruction from the cache. Otherwise,control 250 obtains the applicable branch from instruction store 220. Ifthe branch has been retrieved from store 220 for the first time, it willnot be cached. However, if the branch has been previously retrieved,control 250 may decide to cache the branch based on the last time thebranch was processed relative to the other branches stored in the cache.

Conversely, the system and method may be implemented in even largernetwork based systems than those described above. For example and asshown in FIG. 3, edge server 310 may request data from second tierservers 315-16, which may have their own caches 325-26 and sets ofrequest records 335-36 and contain only a portion of files that areavailable from other servers operated by the company operating theservers illustrated in FIG. 3. In many circumstances, the second tier ofservers will have greater storage capacity, such as a larger cache size,than the edge server. Second tier servers 315-16 may thus request filesfrom other servers such as third tier servers 340-41, which in turn maystore (or otherwise be capable of obtaining) all of the informationavailable via server 310. A request for a file from any of the clientdevices 150-53 may thus cause requests for the file and its caching tocascade throughout multiple tiers of the entire system 300. In thatregard, the system and method may be used to determine which files areto be cached at the edge server 310 and which should be redirected tolarge caches with larger capacity.

The system and method may be particularly advantageous when used inconnection with regionally-distributed edge servers. For example, if thesystem and method is implemented at edge servers located in widelydistributed in geographic areas, the requested served by the edgeservers may vary greatly depending on the location. For example, a funnyvideo clip with Japanese language may be more popular among usersserviced by an edge cache in Tokyo, and thus the Tokyo-based edge servermay store that clip. However, the clip may be less popular among usersserviced by an edge cache in London and, accordingly, it will not storethe clip.

A single server may also have multiple tiers of caches and access thosecaches without the aid of a network. For example and as shown in FIG. 4,computer 400 may first check for an item by querying request records 410associated with cache 411. If the item is not in cache 410, it may querya second independent set of request records 420 associated with a secondindependent cache 421. If the second cache does not contain the item,the computer may check other caches associated with other sets ofrequest records.

In that regard, the system and method may be used in connection withdevices having multiple memories of different types. For example, aserver may locally access both a single solid state drive (e.g., a flashdrive) and multiple local disk drives. The flash memory may have lowercapacity than the disk drives, but it may also be able to provide theinformation faster, on average, than the disk drives. Yet further,server may hold less than all of the information that may be requestedfrom it; it may thus access information stored on servers that originatethe information. This information may be stored in the form of chunksthat collectively comprise video files.

FIG. 6 illustrates just one method that may be implemented in a systemthat stores chunks of information in differing tiers of retrieval speedand capacity, e.g., flash memory, disk memory, and memory located atanother node (such as from an origin server). The chunk will beretrieved from the fastest memory storing the chunk, e.g., from theflash memory if it is in the flash memory, from the disk memory if not,and from the origin server if it is stored in neither the flash nor diskmemory. Moreover, whenever the chunk is retrieved from the originserver, a copy may be stored on the local disks (and evict the mostinactive chunk from the local disks if necessary).

However, while a chunk may be automatically stored in the disk memoryafter the chunk is retrieved from the server, it may not beautomatically placed in flash memory after it is retrieved from thedisk. Moreover, a chunk may not be directly promoted from the originserver to the flash memory. Rather, in one aspect of the system andmethod and as shown at reference numerals 610-13, a chunk is onlypromoted from the disk memory to the flash memory when the time elapsedfrom its last request is less than the survival time of the mostrecently evicted chunk in flash memory.

In still another aspect, the system and method of FIG. 6 willautomatically store a chunk in the flash memory if there is room.Alternatively, it may automatically store any chunk received from anorigin server directly into the flash memory (e.g., bypassing the disks)during the time span that begins with the cache being in an empty stateand the cache's first eviction of a chunk.

Rather than relying on the date and time that a client device requestedan item, the cache may also use other time-based events as the basis forcaching decisions. For example, if the item of information is anexecutable file and the system and method is implemented on a personalcomputer, the relevant time of request may be considered the time atwhich the file is loaded from a magnetic disk into a dedicated diskcache (i.e., the request originated in a component of the computer, therequest constituted a demand to load the file into the disk cache, andthe time of the request was when the file began loading). Alternatively,the time of request may be considered the time that the processor beginsexecuting the file after loading it into RAM. Yet further, the time of arequest may be considered the time the request was received, the timethe request was sent, or the time the request was fulfilled.

The system and method may further include various measures to protectthe data. For example, while the request records 145 may be stored asmetadata in RAM for fast access, it records may also be persisted todisk every so often so that if a relevant program crashes or otherwiserestarts, the state may be read from the disk rather than rebuilt.

Most of the foregoing alternative embodiments are not mutuallyexclusive, but may be implemented in various combinations to achieveunique advantages. As these and other variations and combinations of thefeatures discussed above can be utilized without departing from theinvention as defined by the claims, the foregoing description of theembodiments should be taken by way of illustration rather than by way oflimitation of the invention as defined by the claims. It will also beunderstood that the provision of examples of the invention (as well asclauses phrased as “such as,” “including” and the like) should not beinterpreted as limiting the invention to the specific examples; rather,the examples are intended to illustrate only one of many possibleembodiments.

1. A system comprising: a first memory having a first capacity; a secondmemory having a second capacity, the second capacity being greater thanthe first capacity; one or more processors coupled to the first andsecond memories, the one or more processors being configured to: receivea request for a given item of information stored in the second memory;determine a priority value for the given item and each item from aplurality of items of information, the priority value defined as:E _(n)=−1*(ALPHA*LS _(n)+(1−ALPHA)*E _(n-1)), where: “n” represents then^(th) occurrence of a request for the given item; “E_(n)” representsthe priority value at the n^(th) occurrence of the request for the givenitem; “LS_(n)” represents the amount of time that elapsed between then^(th) occurrence of the request for the given item and the previousrequest for the given item; and “ALPHA” represents a value between andincluding 0 and 1; and store the given item in the first memory when (i)the given item has been previously requested, and (ii) the priorityvalue of the given item is greater than the priority value of at leastone other item selected from the plurality of items.
 2. The system ofclaim 1, wherein the priority value is assigned a default value when thegiven item of information has not been previously requested.
 3. Thesystem of claim 2, wherein the default value indicates that the givenitem of information has a predetermined priority.
 4. The system of claim1, wherein the priority value indicates whether the request for thegiven item is a first request.
 5. The system of claim 4, wherein thevalue of ALPHA is assigned the value of “1” when the one or moreprocessors determine that the request for the given item is a secondrequest.
 6. The system of claim 1, wherein the first memory has a firstaccess time, the second memory has a second access time, and the firstaccess time is less than the second access time.
 7. The system of claim6, wherein the first access time is an average time for the one or moreprocessors to obtain information from the first memory.
 8. The system ofclaim 1, wherein the at least one other item is removed prior to storingthe given item in the first memory.
 9. The system of claim 8, whereinthe at least one other item is removed when the size of the given itemexceeds the size of the first memory minus the combined size ofplurality of items stored in the first memory.
 10. The system of claim1, wherein the priority function is based on a duration of time betweenrequests for items with less weight and is applied to durations betweenearlier requests for the given item.
 11. A method comprising: receiving,with one or more processors, a request for a given item of informationstored in a first memory, the first memory having a first capacity;determining, with the one or more processors, a priority value for thegiven item and each item from a plurality of items of information, thepriority value defined as:E _(n)=−1*(ALPHA*LS _(n)+(1−ALPHA)*E _(n-1)), where: “n” represents then^(th) occurrence of a request for the given item; “E_(n)” representsthe priority value at the n^(th) occurrence of the request for the givenitem; “LS_(n)” represents the amount of time that elapsed between then^(th) occurrence of the request for the given item and the previousrequest for the given item; and “ALPHA” represents a value between andincluding 0 and 1; and storing, with the one or more processors, thegiven item in a second memory when (i) the given item has beenpreviously requested, and (ii) the priority value of the given item isgreater than the priority value of at least one other item selected fromthe plurality of items, wherein the second memory has a capacity lessthan a capacity of the first memory.
 12. The method of claim 11, furthercomprising assigning the priority value a default value when the givenitem of information has not been previously requested.
 13. The method ofclaim 12, wherein the default value indicates that the given item ofinformation has a predetermined priority.
 14. The method of claim 11,further comprising assigning the priority value a predetermined valuethat indicates whether the request for the given item is a firstrequest.
 15. The method of claim 14, wherein the value of ALPHA isassigned the value of “1” when the one or more processors determine thatthe request for the given item is a second request.
 16. The method ofclaim 11, wherein the first memory has a first access time, the secondmemory has a second access time, and the second access time is less thanthe first access time.
 17. The method of claim 16, wherein the firstaccess time is an average time for the one or more processors to obtaininformation from the first memory.
 18. The method of claim 11, whereinthe at least one other item is removed prior to storing the given itemin the second memory.
 19. The method of claim 18, wherein the at leastone other item is removed when the size of the given item exceeds thesize of the second memory minus the combined size of plurality of itemsstored in the second memory.
 20. The method of claim 11, wherein thepriority function is based on a duration of time between requests foritems with less weight and is applied to durations between earlierrequests for the given item.